/*
 * simple_socket.h
 *
 *  Created on: May 29, 2011
 *      Author: Mario Hock
 */

#ifndef SIMPLE_SOCKET_H_
#define SIMPLE_SOCKET_H_

#include <string>

#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/un.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>

#include "interfaces/Userinputinterface.h"
#include "interfaces/Useroutputinterface.h"

using namespace std;

//TODO
// beispielhafte socket implementierung. das muss später noch anständig werden...
// -----> DEPRECATED


class Mario_Socket : public Userinputinterface, public Useroutputinterface
{
public:

  int sockfd, newsockfd, servlen, n;
  socklen_t clilen;
  struct sockaddr_un  cli_addr, serv_addr;
  char buf[4096];

  void error(const char *);
  void sock_create(string address);
  void sock_close();
  void sock_error(const char *msg);


  /** Userinputinterface, Useroutputinterface **/
  virtual string read_from_user();
  virtual bool write_to_user(string s);

};

#endif /* SIMPLE_SOCKET_H_ */
